package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"os/signal"
	"wxp2p/clientN"
)

// server-client
// var addr = flag.String("addr", "43.138.80.3:8018", "http service address")
var addr = flag.String("addr", "127.0.0.1:8018", "信号服务地址")
var clientId = flag.String("id", "wangxue", "客户端标识符")
var local_port = flag.String("port", "3389", "本地端口")

func main() {
	flag.Parse()
	log.Println("服务端模式")
	interrupt := make(chan os.Signal, 1)
	signal.Notify(interrupt, os.Interrupt)

	cl := clientN.NewServerClient(*addr, *clientId)
	cl.Run()
	var inputcmd string
	for {
		fmt.Scanln(&inputcmd)
		switch inputcmd {
		case "rtcnum":
			log.Println(cl.WebrtcArray)
		case "stop":
			cl.StopRun()
		case "run":
			cl.Run()
		case "exit":
			return
		}
	}
}
